package cate.game.role.res.findback.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBFindBack;
import easy.java.dev.note.NoteField;
import easy.java.practice.errorcode.EcResult;

@ClientMsg(title = "资源找回-领奖 请求")
@OperationSetter(value = GDOperation.RES_FIND_BACK, sub = "funcId")
public class FindBackGetRewardReq implements MsgInput {
    @NoteField("功能ID")
    public int funcId;
    @NoteField("找回类型")
    public byte type;

    @Override
    public MsgConfig conf() {
        return MsgIdBFindBack.FIND_BACK_GET_REWARD_REQ;
    }

    @Override
    public void execute(GameBody game, ClientContext cc) {
        EcResult<Void> r = cc.getRole().getRes().findBack.onGetReward(funcId, type);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r);
        } else {
            cc.getRole().getRes().findBack.noticeUpdate();
        }
    }
}
